package org.apache.lucene.analysis.kr.utils;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import org.apache.commons.dbcp.ConnectionFactory;

/**
 * 
 * Created on 2009. 5. 8.
 * @author Ryu Seung Wan
 */
public class DBConnFactory implements ConnectionFactory {

	public static String DRIVER = "";
	public static String URL = "";
	public static String USER = "";
	public static String PASSWORD = "";
	
	public static int idx = 0;

	public DBConnFactory(){}
	
	public DBConnFactory(String driver, String url, String user, String password){
		this.DRIVER = driver;
		this.URL = url;
		this.USER = user;
		this.PASSWORD = password;
	}
	
	public Connection createConnection() throws SQLException {
		Connection con = null;
		try {
			Class.forName(DRIVER);
			con = DriverManager.getConnection(URL, USER, PASSWORD);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return con;
	}
}
